package com.dao.Impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.dao.BaseDao;
import com.dao.MusicListTypeDao;
import com.entity.MusicListType;

@Repository
public class MusicListTypeDaoImpl extends BaseDao implements MusicListTypeDao{

	@Override
	public List<Map<String, Object>> queryMusicListType() {
		String sql ="select musicListTypeId,musicListTypeName from musicListType";
		return executeQuery(sql, null);
	}

	@Override
	public Map<String, Object> queryMusicListTypeId(int musicListTypeId) {
		String sql ="select musicListTypeId,musicListTypeName from musicListType where musicListTypeId=?";
		Object[] params={musicListTypeId};
		return executeQueryMap(sql, params);
	}

	@Override
	public int addMusicListType(MusicListType musicListType) {
		String sql ="insert into musicListType(musicListTypeName)values(?)";
		Object[] params={musicListType.getMusicListTypeName()};
		return executeUpdate(sql, params);
	}

	@Override
	public int editMusicListType(MusicListType musicListType) {
		String sql ="update musicListType 	set musicListTypeName=?	where musicListTypeId=?";
		Object[] params={musicListType.getMusicListTypeName(),musicListType.getMusicListTypeId()};
		return executeUpdate(sql, params);
	}

	@Override
	public int delMusicListType(int musicListTypeId) {
		String sql ="delete from musicListType where musicListTypeId=?";
		Object[] params={musicListTypeId};
		return executeUpdate(sql, params);
	}

}
